/**
 * 
 */
package GUI.main.navigation;


import javax.swing.JPanel;
import javax.swing.border.MatteBorder;

import GUI.helpers.ProjectConstants;
import GUI.main.MainClient;
import officeserver.log_error.UserException;
import officeserver.users.AccessLevel;

/**
 * JPanel to be placed in the main layout--takes in user to determine type of
 * layout.
 * 
 * @author mramsey3
 * 
 */
public class NavigationMenuPanel extends JPanel {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private PatientNavigationMenuPanel patientNavigationMenuPanel;
    private DoctorNavigationMenuPanel doctorNavigationMenuPanel;
    private NurseNavigationMenuPanel nurseNavigationMenuPanel;
    private AdminNavigationMenuPanel adminNavigationMenuPanel;

    /**
     * @param user
     */
    public NavigationMenuPanel() {
	super();
	this.setBorder(new MatteBorder(4,4,4,0,ProjectConstants.BORDER_MAIN_COLOR));
	initialize();
    }

    /**
     * 
     */
    public void initialize() {
	this.removeAll();
	AccessLevel temp = null;
	try {
	    temp = MainClient.getConnection().getSelfPersonalInfo()
		    .getAccessLevel();
	} catch (UserException e) {
	    e.printStackTrace();
	}
	switch (temp) {
	case PATIENT:
	    add(getPatientNavigationMenuPanel());
	    break;
	case DOCTOR:
	    add(getDoctorNavigationMenuPanel());
	    break;
	case NURSE:
	    add(getNurseNavigationMenuPanel());
	    break;
	case ADMIN:
	    add(getAdminNavigationMenuPanel());
	    break;
	}
    }

    /**
     * @author mramsey3
     * @return
     */
    public PatientNavigationMenuPanel getPatientNavigationMenuPanel() {
	if (patientNavigationMenuPanel == null) {
	    patientNavigationMenuPanel = new PatientNavigationMenuPanel();
	}
	return patientNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @param patientNavigationMenuPanel
     */
    public void setPatientNavigationMenuPanel(
	    PatientNavigationMenuPanel patientNavigationMenuPanel) {
	this.patientNavigationMenuPanel = patientNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @return
     */
    public DoctorNavigationMenuPanel getDoctorNavigationMenuPanel() {
	if (doctorNavigationMenuPanel == null) {
	    doctorNavigationMenuPanel = new DoctorNavigationMenuPanel(this);
	}
	return doctorNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @param doctorNavigationMenuPanel
     */
    public void setDoctorNavigationMenuPanel(
	    DoctorNavigationMenuPanel doctorNavigationMenuPanel) {
	this.doctorNavigationMenuPanel = doctorNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @return
     */
    public NurseNavigationMenuPanel getNurseNavigationMenuPanel() {
	if (nurseNavigationMenuPanel == null) {
	    nurseNavigationMenuPanel = new NurseNavigationMenuPanel(this);
	}
	return nurseNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @param nurseNavigationMenuPanel
     */
    public void setNurseNavigationMenuPanel(
	    NurseNavigationMenuPanel nurseNavigationMenuPanel) {
	this.nurseNavigationMenuPanel = nurseNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @return
     */
    public AdminNavigationMenuPanel getAdminNavigationMenuPanel() {
	if (adminNavigationMenuPanel == null) {
	    adminNavigationMenuPanel = new AdminNavigationMenuPanel();
	}
	return adminNavigationMenuPanel;
    }

    /**
     * @author mramsey3
     * @param adminNavigationMenuPanel
     */
    public void setAdminNavigationMenuPanel(
	    AdminNavigationMenuPanel adminNavigationMenuPanel) {
	this.adminNavigationMenuPanel = adminNavigationMenuPanel;
    }
}
